package com.example.xiaoxueqixiangmu;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.example.xiaoxueqixiangmu.Fragment.MineFragment;
import com.example.xiaoxueqixiangmu.Fragment.OrderFragment;
import com.example.xiaoxueqixiangmu.Fragment.TicketFragment;

public class MyFragmentAdapter extends FragmentPagerAdapter {
    private final static int TAB_COUNT=3;
    public MyFragmentAdapter(FragmentManager fm){
        super(fm);
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        switch (position){
            case MyFragmentActivity.TAB_TICKET:
                TicketFragment ticketFragment=new TicketFragment();
                return ticketFragment;
            case MyFragmentActivity.TAB_ORDER:
                OrderFragment orderFragment=new OrderFragment();
                return orderFragment;
            case MyFragmentActivity.TAB_MINE:
                MineFragment mineFragment=new MineFragment();
                return mineFragment;
        }
        return null;
    }

    @Override
    public int getCount() {
        return TAB_COUNT;
    }
}
